package com.feng.common.validation.validator;

import cn.hutool.core.util.StrUtil;
import com.feng.common.validation.constraints.Gender;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @author Feng
 * @since 2022/4/19 18:21
 */
public class GenderValidator implements ConstraintValidator<Gender, String> {
    @Override
    public boolean isValid(String gender, ConstraintValidatorContext context) {
        return StrUtil.isBlank(gender) || "男".equals(gender) || "女".equals(gender);
    }
}
